////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           BailterRay                                       //
//                    Pip Robbins & Zhao Zhang                                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
class BailterRayWeap_RayGun extends UTWeapon;

simulated function DrawWeaponCrosshair( Hud HUD )
{

}

simulated function Projectile ProjectileFire()
{
	local vector RealStartLoc;
	local Projectile SpawnedProjectile;

    local BailterRayPawn P;
    local vector LaserSocketLoc;
    local vector TargetLocation;
	local ImpactInfo Impact;

    P = BailterRayPawn(Instigator);
    P.CurrentWeaponAttachment.Mesh.GetSocketWorldLocationAndRotation('RayStartBeam', LaserSocketLoc);

	// tell remote clients that we fired, to trigger effects
	IncrementFlashCount();

	if( Role == ROLE_Authority )
	{
		// this is the location where the projectile is spawned.
		RealStartLoc = GetPhysicalFireStartLoc();

		// Spawn projectile
		SpawnedProjectile = Spawn(GetProjectileClass(),,, RealStartLoc);


		if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
		{
		    if(P.IsHumanControlled())
		    {
			    Impact = P.Weapon.CalcWeaponFire(LaserSocketLoc, (LaserSocketLoc + vector(P.GetViewRotation()) * 22000));
	            TargetLocation = Impact.HitLocation;
			    SpawnedProjectile.Init(normal(TargetLocation - RealStartLoc));
			    return SpawnedProjectile;
		    }

            SpawnedProjectile.Init(Vector(GetAdjustedAim(RealStartLoc)));

		}

		// Return it up the line
		return SpawnedProjectile;
	}

	return None;
}

defaultproperties
{

   ShotCost(0)=0
   ShotCost(1)=1000
   FireInterval(0)=0.75
   WeaponRange=400
   WeaponFireTypes(0)=EWFT_Projectile
   WeaponFireAnim(1)= none

   WeaponPutDownSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_LowerCue'
   WeaponEquipSnd=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_RaiseCue'
   WeaponFireSnd(0)=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_FireCue'

   FireOffset=(X=25,Y=1,Z=-6)

   WeaponProjectiles(0)=Class'BailterRay.BailterRayProj_Ray'

   AttachmentClass=Class'BailterRay.BailterRayAttachment_RayGun'
   Begin Object Name=FirstPersonMesh
      SkeletalMesh=SkeletalMesh'BailterRay_RayGun.RayGun'
      Animations=AnimNodeSequence'UTGame.Default__UTWeap_ShockRifle:MeshSequenceA'
      AnimSets(0)=AnimSet'WP_ShockRifle.Anim.K_WP_ShockRifle_1P_Base'
   End Object
   Mesh=FirstPersonMesh

   Begin Object Name=PickupMesh
      SkeletalMesh=SkeletalMesh'BailterRay_RayGun.RayGun'
   End Object
   DroppedPickupMesh=PickupMesh
   PickupFactoryMesh=PickupMesh

   PickupMessage=""

   Name="Default__BailterRay_RayGun"
   ObjectArchetype=UTWeapon'UTGame.Default__UTWeapon'

}